package com.example.demo.controller;

import com.example.demo.entity.fin;
import com.example.demo.service.alreadyfinserviceInter;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("alfin")
public class alreadyfincontroller {
    @Autowired
    alreadyfinserviceInter afdao;

    @RequestMapping("display")
    public PageInfo<fin> display(@RequestParam(value = "pagenum", required = false, defaultValue = "1")Integer pagenum,
                                 @RequestParam(value = "pagesize", required = false, defaultValue = "5")Integer pagesize,
                                Model model) {
        PageInfo<fin> finpageinfo = afdao.display(pagenum, pagesize);
        model.addAttribute("finpageinfo", finpageinfo);

        return finpageinfo;
    }

    @RequestMapping("/search")
    public List<fin> search(fin f) {
        return afdao.search(f);
    }
}
